<?php

/**
 * tablica actions.
 *
 * @package    tablica
 * @subpackage tablica
 * @author     Mateusz_Jankowski
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class tablicaActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
    
  /*public function preExecute()
  {
      $request = $this->getRequest();

      if(!($request->isMethod('post') OR $request->isXmlHttpRequest()))
      {
          $this->forward404();
      }
  }*/

  public function executeIndex(sfWebRequest $request)
  {
      $this->tablica = tablicaPeer::pobierzNaTablice($this->getUser()->getPracownik());
      $this->form = new postForm();
  }

  public function executeShow(sfWebRequest $request)
  {
      if($request->isXmlHttpRequest())
      {
          $a = $request->getPostParameter('input[post]');

          $tab = new sfTablica($a);
          $result = $tab->init();
          //$wall_url = $result->_url;

          //$this->getResponse()->setHttpRequest("Conc");

          return $this->renderPartial("show", array('wall' => $result));
      }
      else
      {
          $this->redirect('@homepage');
      }
  }

  public function executeSavePost(sfWebRequest $request)
  {
      if($request->isXmlHttpRequest())
      {
          $this->form = new postForm();
          $this->form->bind($request->getParameter('input'));

         $this->forward404();

          //TablicaPeer::dodajNaTablice(13, $this->getUser()->getPracownik(), $this->form->getValue('post'), $this->form->getValue('status_type'));
      }
      //$this->redirect('@homepage');
  }

}
